From b332f3477769d83d1b5c0813639531c258f3c661 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 14 Nov 2008 14:33:25 +0000 Subject: [PATCH] Remove NR_PIRQS definition -- always use NR_IRQS. Signed-off-by: Keir Fraser --- xen/arch/x86/irq.c | 12 ++++++------ xen/drivers/passthrough/io.c | 4 ++-- xen/drivers/passthrough/pci.c | 6 +++--- xen/drivers/passthrough/vtd/x86/vtd.c | 6 +++--- xen/include/asm-ia64/hvm/irq.h | 1 - xen/include/asm-x86/domain.h | 3 +-- xen/include/asm-x86/hvm/irq.h | 1 - xen/include/asm-x86/pirq.h | 11 ----------- xen/include/xen/hvm/irq.h | 2 +- 9 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 xen/include/asm-x86/pirq.h diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index a4fed17004..1924d2c66d 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -770,15 +770,15 @@ int get_free_pirq(struct domain *d, int type, int index) if ( type == MAP_PIRQ_TYPE_GSI ) { - for ( i = 16; i < NR_PIRQS; i++ ) + for ( i = 16; i < NR_IRQS; i++ ) if ( !d->arch.pirq_vector[i] ) break; - if ( i == NR_PIRQS ) + if ( i == NR_IRQS ) return -ENOSPC; } else { - for ( i = NR_PIRQS - 1; i >= 16; i-- ) + for ( i = NR_IRQS - 1; i >= 16; i-- ) if ( !d->arch.pirq_vector[i] ) break; if ( i == 16 ) @@ -805,7 +805,7 @@ int map_domain_pirq( if ( !IS_PRIV(current->domain) ) return -EPERM; - if ( pirq < 0 || pirq >= NR_PIRQS || vector < 0 || vector >= NR_VECTORS ) + if ( pirq < 0 || pirq >= NR_IRQS || vector < 0 || vector >= NR_VECTORS ) { dprintk(XENLOG_G_ERR, "dom%d: invalid pirq %d or vector %d\n", d->domain_id, pirq, vector); @@ -862,7 +862,7 @@ int unmap_domain_pirq(struct domain *d, int pirq) int vector, ret = 0; bool_t forced_unbind; - if ( (pirq < 0) || (pirq >= NR_PIRQS) ) + if ( (pirq < 0) || (pirq >= NR_IRQS) ) return -EINVAL; if ( !IS_PRIV(current->domain) ) @@ -926,7 +926,7 @@ void free_domain_pirqs(struct domain *d) spin_lock(&d->event_lock); - for ( i = 0; i < NR_PIRQS; i++ ) + for ( i = 0; i < NR_IRQS; i++ ) if ( d->arch.pirq_vector[i] > 0 ) unmap_domain_pirq(d, i); diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c index 4229e2355f..fa41b210e0 100644 --- a/xen/drivers/passthrough/io.c +++ b/xen/drivers/passthrough/io.c @@ -62,7 +62,7 @@ int pt_irq_create_bind_vtd( struct dev_intx_gsi_link *digl; int pirq = pt_irq_bind->machine_irq; - if ( pirq < 0 || pirq >= NR_PIRQS ) + if ( pirq < 0 || pirq >= NR_IRQS ) return -EINVAL; spin_lock(&d->event_lock); @@ -261,7 +261,7 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector) spin_lock(&d->event_lock); pirq = hvm_irq_dpci->msi_gvec_pirq[vector]; - if ( ( pirq >= 0 ) && (pirq < NR_PIRQS) && + if ( ( pirq >= 0 ) && (pirq < NR_IRQS) && test_bit(pirq, hvm_irq_dpci->mapping) && (test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[pirq].flags))) { diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 72c123ada4..f75a6132d7 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -171,9 +171,9 @@ static void pci_clean_dpci_irqs(struct domain *d) hvm_irq_dpci = domain_get_irq_dpci(d); if ( hvm_irq_dpci != NULL ) { - for ( i = find_first_bit(hvm_irq_dpci->mapping, NR_PIRQS); - i < NR_PIRQS; - i = find_next_bit(hvm_irq_dpci->mapping, NR_PIRQS, i + 1) ) + for ( i = find_first_bit(hvm_irq_dpci->mapping, NR_IRQS); + i < NR_IRQS; + i = find_next_bit(hvm_irq_dpci->mapping, NR_IRQS, i + 1) ) { pirq_guest_unbind(d, i); kill_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(i)]); diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c index 83d7704256..5a625351fd 100644 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ b/xen/drivers/passthrough/vtd/x86/vtd.c @@ -121,9 +121,9 @@ void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq) return; } /* Multiple mirq may be mapped to one isa irq */ - for ( i = find_first_bit(dpci->mapping, NR_PIRQS); - i < NR_PIRQS; - i = find_next_bit(dpci->mapping, NR_PIRQS, i + 1) ) + for ( i = find_first_bit(dpci->mapping, NR_IRQS); + i < NR_IRQS; + i = find_next_bit(dpci->mapping, NR_IRQS, i + 1) ) { list_for_each_entry_safe ( digl, tmp, &dpci->mirq[i].digl_list, list ) diff --git a/xen/include/asm-ia64/hvm/irq.h b/xen/include/asm-ia64/hvm/irq.h index d163e56e36..faa89fcd5d 100644 --- a/xen/include/asm-ia64/hvm/irq.h +++ b/xen/include/asm-ia64/hvm/irq.h @@ -26,7 +26,6 @@ #define NR_VECTORS 256 #define VIOAPIC_NUM_PINS 48 -#define NR_PIRQS 256 #include diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 3acab04f27..fb95c064ad 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -6,7 +6,6 @@ #include #include #include -#include #define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo) #define is_pv_32bit_domain(d) ((d)->arch.is_32bit_pv) @@ -237,7 +236,7 @@ struct arch_domain /* NB. protected by d->event_lock and by irq_desc[vector].lock */ int vector_pirq[NR_VECTORS]; - int pirq_vector[NR_PIRQS]; + int pirq_vector[NR_IRQS]; /* Pseudophysical e820 map (XENMEM_memory_map). */ struct e820entry e820[3]; diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h index f2220526fd..1f23124279 100644 --- a/xen/include/asm-x86/hvm/irq.h +++ b/xen/include/asm-x86/hvm/irq.h @@ -22,7 +22,6 @@ #ifndef __ASM_X86_HVM_IRQ_H__ #define __ASM_X86_HVM_IRQ_H__ -#include #include #include #include diff --git a/xen/include/asm-x86/pirq.h b/xen/include/asm-x86/pirq.h deleted file mode 100644 index 2041262134..0000000000 --- a/xen/include/asm-x86/pirq.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __XEN_PIRQ_H -#define __XEN_PIRQ_H - -#define PIRQ_BASE 0 -#define NR_PIRQS 256 - -#define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS) -#define NR_DYNIRQS 256 - -#endif /* __XEN_PIRQ_H */ - diff --git a/xen/include/xen/hvm/irq.h b/xen/include/xen/hvm/irq.h index e77239f290..a89e2e9f88 100644 --- a/xen/include/xen/hvm/irq.h +++ b/xen/include/xen/hvm/irq.h @@ -63,7 +63,7 @@ struct hvm_girq_dpci_mapping { /* Protected by domain's event_lock */ struct hvm_irq_dpci { /* Machine IRQ to guest device/intx mapping. */ - DECLARE_BITMAP(mapping, NR_PIRQS); + DECLARE_BITMAP(mapping, NR_IRQS); struct hvm_mirq_dpci_mapping mirq[NR_IRQS]; /* Guest IRQ to guest device/intx mapping. */ struct hvm_girq_dpci_mapping girq[NR_IRQS]; -- 2.30.2